Skip to content

Swoole: Follow symlinks to enable zero-downtime deployment#1009

Closed
mikkpokk wants to merge 9 commits into
laravel:2.xfrom
mikkpokk:patch-1
Closed

Swoole: Follow symlinks to enable zero-downtime deployment#1009
mikkpokk wants to merge 9 commits into
laravel:2.xfrom
mikkpokk:patch-1

Conversation

@mikkpokk
Copy link
Copy Markdown

@mikkpokk mikkpokk commented Mar 12, 2025

Issue is addressed in #1004. This PR fixes the addressed issue.

What does this PR do?

  • If PHP SCRIPT_NAME contains the base directory and it differs from basePath, it replaces realpath paths with symlinked paths.
  • Detects if the server is inside a symlinked directory and replaces realpaths with symlinked paths.
  • Forwards the correct directory path to swoole-server using the environment parameter APP_RELEASE_BIN_DIR.
  • swoole-server uses APP_RELEASE_BIN_DIR instead of the PHP realpath __DIR__.
  • swoole-server listens to the Swoole event beforereload. Whenever the app is reloaded, it clears the PHP directory caches using clearstatcache(true).

@taylorotwell
Copy link
Copy Markdown
Member

Hello! Are you able to update this PR to follow Laravel's code style conventions?

@taylorotwell taylorotwell marked this pull request as draft March 22, 2025 23:06
@mikkpokk
Copy link
Copy Markdown
Author

mikkpokk commented Mar 23, 2025

@taylorotwell Hello! Done. Added the necessary PHPDoc and verified the code with Laravel Pint using vendor/bin/pint.

I've no idea why the Roadrunner tests on the cloud are failing randomly. They are not related at all. Most likely caused by #1008

Comment thread src/Commands/StartSwooleCommand.php
Comment thread src/Commands/StartSwooleCommand.php
@sy-records
Copy link
Copy Markdown
Contributor

I've no idea why the Roadrunner tests on the cloud are failing randomly. They are not related at all. Most likely caused by #1008

Yep, I fixed it. #1023

@mikkpokk mikkpokk marked this pull request as ready for review April 20, 2025 22:22
@taylorotwell
Copy link
Copy Markdown
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants